package org.academic.texteditor.gui.component;

import java.awt.Component;

import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.MouseInputAdapter;

public class ModalAdapter extends InternalFrameAdapter {
	
	private Component glass;

	public ModalAdapter(Component glass) {
		this.glass = glass;

		MouseInputAdapter adapter = new MouseInputAdapter() {};
		glass.addMouseListener(adapter);
		glass.addMouseMotionListener(adapter);
	}

	@Override
	public void internalFrameActivated(InternalFrameEvent e) {
		glass.setVisible(true);
	}
	
	@Override
	public void internalFrameClosed(InternalFrameEvent e) {
		glass.setVisible(false);
	}

}
